<!--
 * @Description: 
 * @Author: charles
 * @Date: 2020-11-03 14:04:56
 * @LastEditors: charles
 * @LastEditTime: 2021-08-01 14:08:37
-->
<template>
  <div class="details" >
    <h2 class="center">{{data.title}}</h2>
    <div class="wrapper"  v-html="data.content"></div>
    <div class="btn">
      <div class="button"  @click="thumpUpHandler(data.id)">点赞</div>
    </div>
  </div>
</template>
<script>
import {get} from '../utils/request'
export default {
 data(){
  return{
    id:'',
   data:{}
  }
 },
 methods:{
//  查询风采的详细信息
findArticleDetails(){
// 数据交互
get('/index/article/findById?id='+this.id).then(res=>{
  // console.log(res,'--------');
  if(res.status == 200){
  this.data = res.data
  }else{
    this.$message({
      type:'error',
      message:res.message
    })
  }
})
},
 thumpUpHandler(){
      let url = "/index/article/thumbUp"
      get(url,{id:this.data.id}).then(res => {
        this.$message({type:"success",message:res.message})
      })
    },
 },
 created(){
// // 拿到从上一个页面传过来的id值
this.id = this.$route.query.id
// 调用查询详情的方法
this.findArticleDetails()
 }
}
</script>

<style scoped lang="scss">
.details{
  .center{
    text-align: center;
    color: #333;
  }
  .wrapper{
   padding: 0 19em;
}
.btns{
  height: 32px;
  width: 980px;
  margin: 0 auto;
  padding: 0 5em;
  margin-bottom: 10px;
  .button{
    width: 30px;
    background-color: #fff;
    font-size: 12px;
    padding: 9px 15px;
    border-radius: 3px;
    line-height: 1;
    margin: 0 auto;
    border: 1px solid #b0b0b060;
    text-align: center;
  }
  .button:hover{
    color: #0189ec;
    cursor: pointer;
    border: 1px solid #0189ec;
  }
}
.btn{
  width: 1204px;
  height: 32px;
  margin : 0 auto;
  padding: 0 5em;
   margin-bottom: 10px;
  .button{
    width: 30px;
    padding: 9px 15px;
    background-color: #fff; 
    font-size: 12px;
    border-radius: 3px;
    border: 1px solid #b0b0b056;
    margin: 0 auto;
    text-align: center;
  }
  .button:hover{
    cursor: pointer;
    color: #0189ec;
    border: 1px solid #0189ec;
  }
}
}
</style>
